"use strict";

angular.module('app.auth', ['ui.router', 'ngCookies'])

 .constant('ACCESS_LEVELS', {
        pub: 1,
        detection: 2,
        godownman: 2,
        info: 2,
        branch: 3,
        head: 4,
        admin: 5
    })

 .config(function ($stateProvider, $urlRouterProvider, ACCESS_LEVELS) {
    
    $stateProvider
      .state('admin', {
         url: '/admin',
         views: {
            root: {
                templateUrl: 'app/auth/views/login.html',
                 controller: 'LoginCtrl'
            }
         },
         data: {
            title: '登录',
            htmlId: 'extr-page',
            access_level : ACCESS_LEVELS.pub

         },
         resolve: {
            srcipts: function(lazyScript){
                return lazyScript.register([
                    'build/vendor.ui.js'
                ])
            }
        }
      })
       
      .state('register', {
           url: '/register',
           views: {
              root: {
                templateUrl: 'app/auth/views/register.html',
                controller: 'RegistCtrl'              
              }             
           },
           data: {
               title: '注册',
               htmlId: 'extr-page',
               access_level: ACCESS_LEVELS.pub
           }
       })
      .state('forgotPassword', {
           url: '/forgot-password',
           views: {
            root:{
                templateUrl: 'app/auth/views/forgot-password.html'
            }
               
           },
           data: {
               title: '忘记密码',
               htmlId: 'extr-page',
               access_level: ACCESS_LEVELS.pub
           }
       })
       .state('error500', {
           url: '/error5',
           views: {
               "content@app": {
                templateUrl: 'app/granary-info/views/error5.html'

               }
           },
           data: {
               title: 'error',
               access_level: ACCESS_LEVELS.pub
           }
       })
  
    $urlRouterProvider.otherwise('/admin');

})